﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace PennApps
{
    public enum CommandAction
    {
        ForceUninstall,
        NaturalUninstall
    }
    public class Command
    {
        public string ProcessName { get; set; }
        public string ModuleLocation { get; set; }
        public CommandAction Action { get; set; }

        public OperationToken GetOperationToken()
        {
            return OperationToken.InferProductFromProcessInformation(ProcessName, ModuleLocation);
        }

        public void Execute()
        {
            switch (Action)
            {
                case CommandAction.ForceUninstall:
                    {
                        GetOperationToken().Uninstall(PennApps.OperationToken.UninstallationMode.Force);
                        break;
                    }
                case CommandAction.NaturalUninstall:
                    {
                        GetOperationToken().Uninstall(PennApps.OperationToken.UninstallationMode.Natural);
                        break;
                    }
                default:
                    break;
            }

        }
    }
}
